#pragma once
class GameMap;
#include <cstdio>
#include "GLResources.h"
#include "Drawable.h"
class GameMap : public Drawable
{
#define MAX_HEIGHT 20;
public:
	GameMap(void);
	GameMap(char* file);

	~GameMap(void);
	RECT* getMapSize(){
		RECT* r = new RECT();
		r->left = 0;
		r->bottom = height;
		r->top= 0;
		r->right = width;
		return r;
	}
	int getHeightAt(int x, int y);
	virtual void draw();

private: 
	GLsizei* vertexCount,* indexCount;
	GLint* vertexArray;
	GLubyte* colorArray;
	GLfloat* normalArray;
	GLuint* indexArray;
	GLuint loadGameMap(char * path);
	GLuint textureNum, buffers[4];
	int height;
	int width;
	void setupNormals();	
	void setupVertices();
	void setupIndices();
	static const int resolution = 2;

	void doTriangleNormal(GLint* p1, GLint* p2, GLint* p3, GLint* p4, GLfloat* n);
};

